jQuery(document).ready(function($) {

	// Post Formats
	if($("#post-formats-select").length) {
		// Hide Post Format Sections
		$('#bandit-format-audio,#bandit-format-link,#bandit-format-quote,#bandit-format-video').hide();

		// Supported post formats
		var post_formats = ['audio','link','quote','video'];

		// Get selected post format
		var selected_post_format = $("input[name='post_format']:checked").val();

		// Show post format meta box
		if(jQuery.inArray(selected_post_format,post_formats) != '-1') {
			$('#bandit-format-'+selected_post_format).show();
		}

		// Hide/show post format meta box when option changed
		$("input[name='post_format']:radio").change(function() {
			$('#bandit-format-audio,#bandit-format-link,#bandit-format-quote,#bandit-format-video').hide();
			if(jQuery.inArray($(this).val(),post_formats) != '-1') {
				$('#bandit-format-'+$(this).val()).show();
			}
		});
	}

	// Hide post editor
	if($("#page_template").length) {
		var templates = ['template-front.php','template-front-alt.php','template-portfolio.php'];
		var template = $("#page_template").val();
		if(jQuery.inArray(template,templates) != '-1') {
			$('#postdivrich').hide();
		}
	}

});